//
//  JYMineMenuCell.m
//  JYShop
//
//  Created by 花花 on 2017/9/28.
//  Copyright © 2017年 花花. All rights reserved.
//

#import "JYMineMenuCell.h"
//#import "LYMineMenuModel.h"
@interface JYMineMenuCell ()




@end

@implementation JYMineMenuCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //被选中的样式
        self.autoresizingMask = UIViewAutoresizingNone;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.iconImage];
    [self.contentView addSubview:self.arrowImg];
    [self.contentView addSubview:self.subMoenyLabel];
    
    
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    JYWeakSelf;
    [self.iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.width.height.mas_equalTo(23);
        make.centerY.mas_equalTo(weakSelf.mas_centerY);
        
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.iconImage.mas_right).offset(10);
        make.centerY.mas_equalTo(weakSelf.mas_centerY);
    }];
    
    [self.arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.width.equalTo(@14);
        make.height.equalTo(@28);
        make.centerY.equalTo(weakSelf.iconImage.mas_centerY);
    }];
    
    [self.subMoenyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(weakSelf.arrowImg.mas_left).offset(-8);
         make.centerY.mas_equalTo(weakSelf.mas_centerY);
    }];
    
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"JYMineMenuCell";
    JYMineMenuCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        cell = [[JYMineMenuCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}

#pragma mark - Lazy Methods
- (UILabel *)titleLabel{
    
    if (!_titleLabel) {
        _titleLabel = [UILabel labelText:@"" fontSize:15 textColor:k9Color textAlignment:NSTextAlignmentLeft];
    }
    return _titleLabel;
    
}
- (UIImageView *)iconImage{
    
    if (!_iconImage) {
        _iconImage = [[UIImageView alloc]init];
        _iconImage.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _iconImage;
    
}
- (UILabel *)subMoenyLabel{

    if (!_subMoenyLabel) {
        _subMoenyLabel = [UILabel labelText:@"" fontSize:13 textColor:[UIColor colorWithHexString:@"EF216B"] textAlignment:NSTextAlignmentCenter];
    }
    return _subMoenyLabel;

}


- (UIImageView *)arrowImg{
    if (_arrowImg == nil) {
        _arrowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]];
        _arrowImg.contentMode = UIViewContentModeCenter;
    }
    return _arrowImg;
}
#pragma mark -- setter
//- (void)setMenuModel:(LYMineMenuModel *)menuModel{
//    _menuModel = menuModel;
//    
//    self.titleLabel.text = menuModel.title;
//    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:menuModel.imgUrl] placeholderImage:defaultPlaceholderImage];
//    if (menuModel.isShowPoint) {
//        self.redPoint.hidden = NO;
//    }else{
//        self.redPoint.hidden = YES;
//    }
//}
@end
